home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 10 / FM Towns Free Software Collection 10.iso / ms_dos / tool / fapxtool / src / txl / txltime.c < prev   
C/C++ Source or Header  |  1994-10-19  |  677b  |  40 lines

  1. /***************
  2. *
  3. * g:\exe\txl\src\txltime.c
  4. */
  5. #include "txl.h"
  6.  
  7. void settime(char *tmstr)
  8. {
  9.     int hour, minute, second;
  10.     struct dostime_t stm;
  11.  
  12.     if (sscanf(tmstr, "%02d:%02d:%02d", &hour, &minute, &second) < 3) {
  13.         Exit(1);
  14.     }
  15.     stm.hour = hour;
  16.     stm.minute = minute;
  17.     stm.second = second;
  18.     stm.hsecond = 0;
  19.     _dos_settime(&stm);
  20. }
  21.  
  22. void setdate(char *dtstr)
  23. {
  24.     int year, month, day;
  25.     struct dosdate_t sdt;
  26.  
  27.     if (sscanf(dtstr, "%02d/%02d/%02d", &year, &month, &day) < 3) {
  28.         Exit(1);
  29.     }
  30.     sdt.year = year + 1900;
  31.     if (sdt.year < 1980) {
  32.         sdt.year += 100;
  33.     }
  34.     sdt.month = month;
  35.     sdt.day = day;
  36.     sdt.dayofweek = 0;
  37.     _dos_setdate(&sdt);
  38. }
  39.  
  40.